package company.C360;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class C2 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = i + 1;
        }
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < m; i++) {
            int methodType = sc.nextInt();
            if (methodType == 1)
                list.add(1);
            else if (methodType == 2) {
                int lastIndex = list.size() - 1;
                if (list.size() == 0)
                    list.add(2);
                else if (list.get(lastIndex) == 2)
                    list.remove(lastIndex);
                else
                    list.add(2);
            }
        }
        for (Integer i : list) {
            if (i == 1)
                method1(array, n);
            else if (i == 2)
                method2(array, n);
        }
        for (int num : array) {
            System.out.print(num + " ");
        }
    }

    private static void method1(int[] array, int n) {
        int tmp = array[0];
        for (int i = 0; i < n - 1; i++) {
            array[i] = array[i + 1];
        }
        array[n - 1] = tmp;
    }

    private static void method2(int[] array, int n) {
        for (int i = 0; i < n; i += 2) {
            int tmp = array[i];
            array[i] = array[i + 1];
            array[i + 1] = tmp;
        }
    }
}
